package com.example.ercmssystem2.repository;

import com.example.ercmssystem2.entity.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface UserRepository extends JpaRepository<User, Long> {
    
    User findByUsername(String username);
    
    boolean existsByUsername(String username);
    
    boolean existsByEmail(String email);
    
    List<User> findByDepartmentIdAndEnabledTrue(Long departmentId);
    
    List<User> findByRoleAndEnabledTrue(String role);
    
    List<User> findByRoleInAndEnabledTrue(List<String> roles);
    
    List<User> findByDepartmentId(Long departmentId);
    
    List<User> findByDepartmentIdInAndEnabledTrue(List<Long> departmentIds);
    
    List<User> findByStatusAndEnabledTrue(String status);
    
    List<User> findByStatusInAndEnabledTrue(List<String> statuses);
    
    List<User> findByRoleInAndStatusAndEnabledTrue(List<String> roles, String status);
} 